package com.session01;

public class Inner {
    String name = "xiao";

    private void test() {
        System.out.println("在父类的私有方法里面");
    }

    public InnerInterface play() {
        int msg1 = 0;

        //匿名内部类
        InnerInterface innerInterface = new InnerInterface() {
            int i1 = 0;

            @Override
            public void run() {
                System.out.println("run " + name + msg1 + i1);
                test();
            }

            @Override
            public void eat() {
                System.out.println("eat " + name);
            }
        };

        return innerInterface;
    }

    public static void main(String[] args) {
/*        Inner inner = new Inner();
        inner.play().run();
        inner.play().eat();*/

        Inner inner = new Inner();
        InnerInterface i = inner.play();
        i.eat();
        i.run();
    }
}